import serve from './index'
// 按需导出

// 获取页码数
export function getPages(majorName, className, name) {
    return serve({
        url: '/admin/student/page/count',
        method: 'get',
        params: {
            majorName: majorName,
            className: className,
            name: name
        }
    })
}

// 获取学员信息
export function getStudent(id) {
    return serve({
        url: '/admin/student/' + id,
        method: 'get',
    })
}
// 搜索
export function getList(page, name, majorName, className) {
    return serve({
        url: '/admin/student/page/' + page,
        method: 'get',
        params: {
            majorName: majorName,
            className: className,
            name: name
        }
    })
}


// 搜索全部
export function getListAll() {
    return serve({
        url: '/admin/class/names',
        method: 'get',
    })
}


// 添加
export function ADDList(name, number, classId, password, email, birthday, sex) {
    return serve({
        url: '/admin/student',
        method: 'post',
        data: {
            birthday: birthday,
            classId: classId,
            email: email,
            name: name,
            number: number,
            password: password,
            sex: sex,
            id: -1,
        }
    })
}

// 更改
export function changeorno(name, number, classId, password, email, birthday, sex,id) {
    return serve({
        url: '/admin/student',
        method: 'put',
        data: {
            name: name,
            number: number,
            classId: classId,
            password: password,
            email: email,
            birthday: birthday,
            sex: sex,
            id:id
        }
    })
}

// 删除
export function deleted(id) {
    return serve({
        url: '/admin/student/' + id,
        method: 'delete',
    })
}